package  
{
	import net.flashpunk.graphics.Text;
	import net.flashpunk.Entity;
	
	public class WallBounce extends Entity
	{
		[Embed(source = 'fonts/fracas_font.ttf', embedAsCFF = "false", fontFamily = 'SCORE_FONT')]
		private const SCORE_FONT:Class;
		public var theText:Text;
		
		public var count:int;
		public var hits: int;
		public var points: int;
		public var theSize:int;
		
		public function WallBounce() 
		{
			count = 0;
			hits = 0;
			
			Text.font = "SCORE_FONT";
			theText = new Text("");
			theText.resizable = true;
			graphic = theText; 
			theSize = 0;
			theText.color = 0xFFFFFF
			layer = -1;
		}
		
		public override function update():void {
			if (count == 30) {
				if (hits == 1) points = 200;
				if (hits == 2) points = 1500;
				if (hits == 3) points = 5000;
				if (hits > 3) points = 10000;
				fracasWorld.score = fracasWorld.score + points;
			}
			if (count == 0) theText.text = "";
			
			if (count > 0) {
				if (count > 15) theSize++;
				if (count <= 15) theSize--;
				theText.size = theSize;
				count--;
			}
			
		}
		
	}

}